package com.cldz.controller;

import com.cldz.common.dto.req.VirtualChannelDto;
import com.cldz.common.dto.res.VirtualChannelResDto;
import com.cldz.feign.VirtualChannelFeign;
import com.cldz.response.support.ServerResponse;
import com.cldz.service.VirtualChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ Author     ：lixiao.
 * @ Date       ：Created in 16:46 2018/12/18
 * @ Description：虚拟通道属性
 * @ Modified By：
 */
@Slf4j
@RestController
public class VirtualChannelController implements VirtualChannelFeign {

    @Autowired
    private VirtualChannelService virtualChannelService;

    /**
     * 根据设备类型获取虚拟通道属性
     * @param virtualChannelDto
     * @return
     */
    @GetMapping("/vChannelProperty")
    public ServerResponse getVirtualChannelProperties(VirtualChannelDto virtualChannelDto){
        List<VirtualChannelResDto> list = virtualChannelService.getVirtualChannelProperties(virtualChannelDto);
        Integer amount = virtualChannelService.getVirtualChannelPropertiesAmount(virtualChannelDto);
        return ServerResponse.createDataAndCount(amount,list);
    }

    /**
     * 获取指定虚拟通道属性
     * @param virtualChannelDto
     * @return
     */
    @GetMapping("/specifyVChannelProperty")
    public ServerResponse getSpecifyVirtualChannelProperty(VirtualChannelDto virtualChannelDto){
        VirtualChannelDto data  = virtualChannelService.getSpecifyVirtualChannelProperty(virtualChannelDto);
        return ServerResponse.createDataList(data);
    }


}
